//
//  DEWInviteCodeController.m
//  OtherDemo
//
//  Created by kangbinbin on 2018/7/31.
//  Copyright © 2018年 lianjie. All rights reserved.
//

#import "DEWInviteCodeController.h"
#import "UIBarButtonItem+MainBar.h"
#import "UIImage+ZYQRCode.h"
#import "FDActionSheet.h"

@interface DEWInviteCodeController ()<FDActionSheetDelegate>
/** 分享View */
@property (strong, nonatomic) FDActionSheet *sheet;

@end

@implementation DEWInviteCodeController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self loadData];
    
    [self createView];
    
}

#pragma mark ----RequestData
-(void)loadData
{
    
    
}

#pragma mark ----initView
-(void)createView
{
    self.view.backgroundColor = UIColorFromRGB(0xF5F5F5);
    self.navigationItem.title = @"邀请码";
    UIBarButtonItem *rightItem = [UIBarButtonItem itemWithTarget:self action:@selector(rightBarButtonItemClick) image:@"更多1" highImage:@"更多1" andTitle:nil];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    self.codeImgView.image = [UIImage ZY_ImageOfQRFromURL:@"我是中华人民共和国主席" codeSize:200];
    
    
}
#pragma mark - 导航栏右边按钮点击事件
-(void)rightBarButtonItemClick{
    [self.view addSubview:self.sheet];
    [self.sheet show];
}

#pragma mark - FDActionSheetDelegate

-(void)actionSheet:(FDActionSheet *)sheet clickedButtonIndex:(NSInteger)buttonIndex{
    if (buttonIndex == 0) {//分享
        
    }else{//保存图片
        
    }
}

-(FDActionSheet *)sheet{
    if (_sheet == nil) {
        _sheet = [[FDActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"分享",@"保存图片", nil];
        _sheet.delegate = self;
    }
    return _sheet;
}
@end
